package edu.stu.cs.software.family.shoppingcart.domian;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import edu.stu.cs.software.family.base.domain.BaseTreeEntity;

@Table(name = "O_SHOPPINGCART")
@Entity
@NamedQueries({ @NamedQuery(name = "ShoppingCart.getRoot", query = "select g from ShoppingCart g where g.parent is null") })

public class ShoppingCart extends BaseTreeEntity<ShoppingCart,Long> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8669557304331579085L;
	
	@OneToMany(mappedBy = "shoppingcart", cascade = CascadeType.REMOVE, fetch = FetchType.EAGER)
	Set<Order> orders;
	
@Column(name = "CODE")
	String code;//商品编号
	@Column(name = "NAME")
	String name;//商品名字
	@Column(name = "PRINCE")
	String prince;//价格
	@Column(name = "NUMBER")
	String number;//数量
	public Set<Order> getOrders() {
		return orders;
	}

	public void setOrders(Set<Order> orders) {
		this.orders = orders;
	}

	public String getPrince() {
		return prince;
	}

	public void setPrince(String prince) {
		this.prince = prince;
	}

	public String getNumber() {
		return number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
}
